package cate.game.play.buff.h;

import cate.common.table.d.GD;
import cate.common.table.d.GDSkill;
import cate.common.util.XT;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.effect.SkillEffect;
import easy.java.dev.note.NoteField;

import java.util.List;

/**
 * 出手时有概率无视护盾
 */
public class 无视护盾BH extends BuffHandler {

	@NoteField("概率")
	private int 概率;

	@NoteField("技能标签")
	private List<String> 技能标签;

	//概率=3000&技能标签=疾影袭心
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		概率 = args.getInt("概率", 0);
		技能标签 = args.getStrList("技能标签");
	}

	@Override
	public void beforeSkillSettleAsActor(SkillActionCtx action, SkillEffect effect, Fighter target) {
		if (!action.getSkill().cfg.isEffectType(GDSkill.EffectType.伤害)) {
			return;
		}
		if (!XT.chance(概率)) {
			return;
		}
		if (XT.isNotBlank(技能标签) && !action.getSkill().cfg.containTags(技能标签)) {
			return;
		}
		effect.getTargetCtx(target.getPid()).addIgnShieldRate(GD.W_10000_0);
	}
}
